package com.xinjian.jianba.controller;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xinjian.jianba.dto.LableTreeDto;
import com.xinjian.jianba.exception.ResponseCode;
import com.xinjian.jianba.service.LableService;

/**
 * 标签树
 */
@RestController
@RequestMapping("/api/v3/jianba/lable")
public class LableController extends AbstractController {
	private static final Logger LOGGER = LoggerFactory.getLogger(LableController.class);

	@Autowired
	private LableService lableService;

	@PostMapping(value = { "/lableTree" })
	public String upload() {
		List<LableTreeDto> resultList = null;
		try {
			resultList = lableService.LableTree();
		} catch (Exception e) {
			LOGGER.error("--------error--->>>>>", e);
			return this.responseClientJsonData(ResponseCode.BAD_REQUEST, ResponseCode.ERROR_MSG);
		}
		return this.responseClientJsonData(ResponseCode.SUCCESS, ResponseCode.SUCCESS_MSG, resultList);
	}
}
